<%
strUsername = "adslsky"
strPassword = "998877"
%>
<%
	Randomize
	
	Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.5.0")
	xmlHttp.open "GET", "http://www.77go.cn/authimg?a=" & Rnd, false
	xmlHttp.send
	
	Cookie = xmlHttp.getResponseHeader("Set-Cookie")
	Cookie = Replace(Cookie, "; path=/", "")
	AuthCode = Replace(Cookie, "AI=", "")
	
	xmlHttp.open "POST", "http://www.77go.cn/login.bbscs", false
	xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	xmlHttp.send "username=" & strUsername & "&tourl=indexpage&action=login&passwd=" & strPassword & "&authcode=" & AuthCode
	RespnoseBody = xmlHttp.responseText
	
	RespnoseBody = Mid(RespnoseBody, 1, 170)
	If Instr(RespnoseBody, "alert") > 0 Then
			Response.Write "登录失败"
	Else
			Response.Write "登录成功"
			
			xmlHttp.open "GET", "http://www.77go.cn/userInfo.bbscs?t=name&username=" & Request.Form("Text1"), false
			xmlHttp.send
			RespnoseBody = xmlHttp.responseText
			
			StrHerf1 = "<a href="
			StrHerf2 = " "			
			Pos1 = InStr(RespnoseBody, StrHerf1)
			If Pos1 > 1 Then
					Pos1 = Pos1 + Len(StrHerf1)
					Pos2 = InStr(Pos1, RespnoseBody, StrHerf2)
					If Pos2 > 1 Then
							ImagesURL = Mid(RespnoseBody, Pos1, Pos2 - Pos1)
							ImagesURL = Replace(ImagesURL, "'", "")
							ImagesURL = "http://www.77go.cn/" & ImagesURL
							ImagesURL = "http://www.77go.cn/file/user/75/26713/267131163645905584.jpg"
							Response.Write(ImagesURL)
							
							xmlHttp.open "GET", ImagesURL, false
							xmlHttp.setRequestHeader "Referer", "http://www.77go.cn/in.bbscs"
							xmlHttp.send							
							
							RespnoseStream = xmlHttp.responseBody
							
							Set Ads = Server.CreateObject("Adodb.Stream") 
							With Ads 
								.Type = 1 
								.Open 
								.Write RespnoseStream 
								.SaveToFile Server.MapPath("a.jpg"), 2 
								.Cancel() 
								.Close() 
							End With 
							Set Ads = nothing
					End If
			End If
	End If
%>
